from pptx import Presentation
# 引入图形
from pptx.enum.shapes import MSO_SHAPE
from pptx.util import Inches

prs = Presentation()
# 这个布局只有一个标题，其他自己添加
title_only_slide_layout = prs.slide_layouts[5]
slide = prs.slides.add_slide(title_only_slide_layout)
shapes = slide.shapes

shapes.title.text = 'Adding an AutoShape'

left = Inches(0.93) 
top = Inches(3.0)
width = Inches(1.75)
height = Inches(1.0)
# 给Step 1添加图形，并设定所在位置
shape = shapes.add_shape(MSO_SHAPE.PENTAGON, left, top, width, height)
shape.text = 'Step 1' #设置图形文字
# 设定后面图形的位置
left = left + width - Inches(0.4)
width = Inches(2.0)  
# 循环添加后面的几个图形：Step 2等。动态改变位置
for n in range(2, 6):
    shape = shapes.add_shape(MSO_SHAPE.CHEVRON, left, top, width, height)
    shape.text = 'Step %d' % n
    left = left + width - Inches(0.4)

prs.save('7.1.6.pptx')
